// 4. 游戏计时器模块 - 直接使用10Hz时钟计时
module game_timer(
    input clk_100ms,        // 10Hz时钟作为时钟源
    input rst_n,
    input game_start,
    input game_reset,
    input [1:0] game_state,
    output reg [15:0] total_time_100ms  // 总时间，单位0.1秒
);
    
    parameter PLAYING = 2'b01;
    
    always @(posedge clk_100ms or negedge rst_n) 
    begin
        if (!rst_n) 
        begin
            total_time_100ms <= 0;
        end 
        else if (game_reset) 
        begin
            total_time_100ms <= 0;
        end 
        else if (game_state == PLAYING) 
        begin
            total_time_100ms <= total_time_100ms + 1;
        end
    end
endmodule